-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Add act #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add act #41
Conversation
LGTM, thanks for contributing, @EmilTholin look good to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing then we can merge
Sorry for the slow reply, I just got back from vacation. I think it looks good! I think an |
@EmilTholin if that's the case then I'm actually thinking it would stay as is. I'd rather keep this in the spirit of svelte. Can you confirm an await will work? If so maybe we busy update the docs accordingly? |
This was discussed in this issue a while back and @pngwn was kind enough to outline and explain why The ability to return any promise from |
I'd rather use public API from svelte. Looking at
it sounds like |
@allcontributors please add @eps1lon for code |
I've put up a pull request to add @eps1lon! 🎉 |
🎉 This PR is included in version 1.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds a function which can wrap testing actions and guarantees that after awaited state updates are flushed to the DOM.
Internal it just calls the callback and returns the promise from svelte's
tick
. This should replace the current documented approach of usingwait
+expect
orwaitForElement
. The previous behavior either waited too long (default timeout of 2s) or was flaky if the timeout was really short. It's also slow when usingwait
since that uses polling.It essentially mimics the
act
from React.